﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Library;
using QLKH.PopUp;

namespace QLKH.PopUp.taodulieu
{
    public partial class TinhCuocCQLuyThua : Form
    {
        public TinhCuocCQLuyThua()
        {
            InitializeComponent();
        }

        private void BtnTinh_Click(object sender, EventArgs e)
        {
            Int64 idkh = Int64.Parse(txtidkh.Text.Trim());
            //int socu = int.Parse(txtChisocu.Text.Trim());
            int somoi = int.Parse((txtChiSomoi.Text.Trim()=="")?"0":txtChiSomoi.Text.Trim());
            int kl1 = int.Parse((txtKL1.Text.Trim()=="")?"0":txtKL1.Text.Trim());
            int kl2 = int.Parse((txtKL2.Text.Trim()=="")?"0":txtKL2.Text.Trim());
            int kl3 = int.Parse((txtKL3.Text.Trim()=="")?"0":txtKL3.Text.Trim());
            //int kltt = 0;
            //kltt = somoi - socu;
            //txtKLTT.Text = kltt.ToString();
            string tbsudung = UpdateData.tbSudungnew;

            clTaoTbSuDung tinhCQluythua = new clTaoTbSuDung();
            tinhCQluythua.tinhcuocCQluythua(idkh, somoi, kl1, kl2, kl3, tbsudung);

            MessageBox.Show("Đã tính cước xong cho khách hàng " + txtMaKH.Text.Trim());

        }

        private void txtChiSomoi_TextChanged(object sender, EventArgs e)
        {
            int socu = int.Parse(txtChisocu.Text.Trim());
            int somoi = int.Parse((txtChiSomoi.Text.Trim() == "") ? "0" : txtChiSomoi.Text.Trim());
            int kltt = 0;
            kltt = somoi - socu;
            txtKLTT.Text = kltt.ToString();
        }

        private void btquit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
